/*
 * REFSocketConnection.h
 *
 *  Created on: May 29, 2013
 *      Author: Lucifer
 */

#ifndef REFSOCKETCLIENT_H_
#define REFSOCKETCLIENT_H_

#include "REFIOEventService.h"

namespace BFX
{

class REFSocketConnection : public REFObject
{
protected:
	friend class REFSocketAcceptor;
	REFSocketConnection(REFSocket* pSocket, REFIOEventService* pIOService = NULL);
public:
	REFSocketConnection();
	virtual ~REFSocketConnection();

	void Close();

	void BeginReceive(IOEventCallback callback, BYTE* pBuffer, int iOffset, int nSize, SocketFlags socketFlags =
			SocketFlags_None);
	int EndReceive(REFIOEventContext* pContext);

private:
	REF<REFIOEventService>	m_pIOService;
	REF<REFSocket>	m_pSocket;
};

} /* namespace BFX */
#endif /* REFSOCKETCLIENT_H_ */
